﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;

namespace Relocation
{
	public partial class WaitForm : Form
	{
		public WaitForm(string title,string lableText)
		{
			InitializeComponent();
			this.Text = title;
			this.label1.Text = lableText;
		}

		//显示（更改）提示文字
		public void ShowText(string LableText)
		{
			this.ExecInvoker(new MethodInvoker(delegate() {
				this.label1.Text = LableText;
			}));
		}

		/// <summary>
		/// 关闭窗口
		/// </summary>
		public void CloseForm()
		{
			MethodInvoker methodInvoker=new MethodInvoker(delegate()
			{
				this.Close();				
			});
			this.ExecInvoker(methodInvoker);
			
		}

		private void ExecInvoker(MethodInvoker methodInvoker)
		{
			if (this.InvokeRequired)
			{
				this.Invoke(methodInvoker);
			} else
			{
				methodInvoker();
			}		
		}
	}
}
